package com.ssy.lingxi.purchase.api.enums.tender;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 招投标外部操作枚举类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/29
 */
public enum TenderOutOperationEnum {

    New_Invite_Tender(1, "新增招标"),
   // Check_Invite_Tender(2, "平台审核招标"),22.1.20版本去掉
    Invite_Tender_Register(3, "招标报名"),
    Check_Register(4, "审核报名"),
    Submit_Qualifications(5, "提交资格预审"),
    Qualifications_Check(6, "资格预审"),
    Submit_Invite_Tender(7, "提交投标"),
    Open_Tender(8, "开标"),
    Selection_Tender(9, "评标"),
    Confirm_Finish_Tender(10, "定标"),
    Send_Win_Notice(11, "发送中标公示"),
    Finish_Invite_Tender(12, "完成招标"),
    Discard_Tender(13, "已废标");

    private Integer code;
    private String message;

    TenderOutOperationEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        TenderOutOperationEnum statusEnum = Arrays.stream(TenderOutOperationEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(TenderOutOperationEnum.class, statusEnum.getCode());
    }
}
